#!/bin/sh

#del.lines.sh
#script takes filename(s) and deletes all blank lines

TEMP_F=/tmp/del.lines.$$

Usage()
{
# usage
	echo "Usage: `basename $0` file [file..]"
	echo "try `basename $0` -help for more info"
	exit 1
}

if [ $# -eq 0 ]; then
	Usage
fi

FILES=$1

while [ $# -gt 0 ]
	do
		echo "..$1"

		case $1 in
			-help)
				cat << MAYDAY
Use this script to delete all blank lines from a text file\(s\)
MAYDAY
				exit 0
				;;
			*) FILE_NAME=$1
			   if [ -f $1 ]; then
				   sed '/^$/d' $FILE_NAME >$TEMP_F
				   mv $TEMP_F $FILE_NAME
			   else
				   echo "`basename $0` can't find this file: $1"
			   fi
			   shift
			   ;;
		esac
	done
